<template>
  <el-dialog
    title="设置"
    :visible.sync="$attrs.visableIf"
    @close="handleCloseDialog"
    width="600px"
    append-to-body
    class="borderb_dia"
  >
    <el-form
      ref="form"
      :model="form"
      :rules="rules"
      label-width="100px"
      label-position="left"
    >
      <el-form-item label="触发延迟" prop="name" class="delay">
        <div class="item-big">
          <el-input type="number" v-model="form.name" size="small"></el-input>
          可设置1-600秒
        </div>
      </el-form-item>
      <div class="tips">
        <div>注意事项：</div>
        <p>1. 若无需按标签区分发送内容，所有客户都发送默认方案，可将延迟调低</p>
        <p>2. 若需要按照标签区分发送内容，建议延迟不低于60秒</p>
        <p>3. 系统同步标签需要时间，延迟设置过低可能导致标签未同步，若因此触发了默认方案，将不再触发别的方案</p>
      </div>
      <el-form-item label="休眠时间段" prop="status">
        <el-switch
          v-model="form.open">
        </el-switch>
      </el-form-item>
      <el-form-item label-width="0px">
        <el-time-picker
            is-range
            v-model="timeRange"
            format="HH:mm"
            value-format="HH:mm"
            range-separator="~"
            start-placeholder="开始时间"
            end-placeholder="结束时间">
        </el-time-picker>
      </el-form-item>
      <div class="tips2">每日00:00 ~ 08:00休眠，休眠时段内新客户运营触发的消息不执行发送，休眠时段过后不会补发。</div>
    </el-form>
    <div slot="footer" class="footer-btn">
      <el-button @click="handleCloseDialog">取消</el-button>
      <el-button type="primary" @click="submitForm">确认</el-button>
    </div>
  </el-dialog>
</template>

<script>
// import { validPhone, validPassword } from "@/utils/validate";
// import { editInfo } from "@/api/advmaster";
export default {
  data() {
    return {
      timeRange:[],//时间范围
      value1: [new Date(2016, 9, 10, 8, 40), new Date(2016, 9, 10, 9, 40)],
      form: {
        id: "",
        name: "",
        phone: "",
        email: "",
        status: "",
        password: "",
        type_id: [],
      },
    timeSet:{
      selectableRange: `08:00:00  - 23:59:00`,
          format:' HH:mm'
    },
      // 表单校验
      rules: {
        name: [{required: true, message: "请输入用户名", trigger: "blur"}],
        email: [
          {
            required: true,
            type: "email",
            message: "请输入正确的邮箱地址",
            trigger: "blur",
          },
        ],
        password: [],
        status: [{required: true, message: "请选择状态", trigger: "change"}],
      },
    };
  },
  props: {
    rowitem: {
      default: null,
    },
  },
  created() {

  },
  methods: {
    changeTime(val){
      console.log('修改val',val);
    },
    //重置表单
    handleReset() {
      this.resetForm("form");
    },

    handleCloseDialog() {
      this.$emit("update:visableIf", false);
    },

    submitForm: function () {
      this.$refs['form'].validate((valid) => {
        if (valid) {
          if (this.form.id != undefined) {
            // editInfo(this.form).then(() => {
            //   this.$modal.msgSuccess('修改成功')
            //   this.handleCloseDialog();
            //   this.$emit('getList');
            // })
          }
        }
      })
    },
  },
};
</script>

<style scoped lang="scss">
::v-deep .el-dialog__body {
  height: auto !important;
}
.operate-Big {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
}

.group-right {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 15px;
}

.item-big {
  display: flex;

  ::v-deep {
    .el-input {
      width: 90px;
      margin-right: 10px;

      .el-input__inner {

      }
    }

  }
}

.tips {
  font-size: 14px;
  line-height: 20px;
  color: rgba(0, 0, 0, .45);
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
  margin-bottom: 10px;
  p {
    padding: 0px;
    margin: 0px;
  }

}

.el-radio-group {
  padding-top: 10px;

  .el-radio {
    margin-bottom: 5px;
  }
}

.delay {
  background: #f0f0f0;
  padding: 16px;
}
.tips2 {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(0, 0, 0, .45);
}
</style>
